function before() {
    var phoneNumber = prompt("请输入11位手机号：");


    phoneNumber = phoneNumber.replace(/\s+/g, '');


    if (phoneNumber.length !== 11) {
        alert("位数错误，请重新输入：");
        before();
        return;
    }


    if (!/^\d+$/.test(phoneNumber)) {
        alert("手机号不全是数字，请重新输入：");
        before();
        return;
    }


    var confirmation = confirm("手机正确，是否跳转到歌曲目录首页：");
    if (confirmation) {
        window.location.href = "http://localhost:8080/demo1_war_exploded/index.jsp";
    }
}

document.getElementById("validatePhoneNumberLink").addEventListener("click", before);
